// import request from '@/utils/request'
import axios from 'axios';

// 角色列表
function getList(params) {
  return axios({
    url: `/system/role/list`,
    method: 'get',
    params,
  });
}

// 获取详情
function getInfo(id: number) {
  return axios({
    url: `/system/role/${id}`,
    method: 'get',
  });
}

// 创建角色
function create(params) {
  return axios({
    url: `/system/role/create`,
    method: 'post',
    data: params,
  });
}

// 更新角色
function update(params) {
  return axios({
    url: `/system/role/update`,
    method: 'post',
    data: params,
  });
}

// 删除角色
function del(id) {
  return axios({
    url: `/system/role/delete/${id}`,
    method: 'delete',
  });
}

function getPerms(id) {
  return axios({
    url: `/system/role/perms/${id}`,
    method: 'get',
  });
}

function updatePerms(params) {
  return axios({
    url: `/system/role/perms`,
    method: 'post',
    data: params
  });
}

export default {
  getList,
  getInfo,
  create,
  update,
  del,
  getPerms,
  updatePerms
}
